package com.common;

import java.util.HashMap;
import java.util.Map;

public class Page
{
	private int pages=0;//
	private int counts=0;//ܼ
	
	public Map pageCount(int counts)
	{
		this.counts=counts;
		Map map_page=new HashMap();
		map_page.put("counts", counts);
			if(counts%Constant.PAGE_VIEW_COUNT!=0)
			{
				pages++;
			}
			pages+=(int)Math.ceil(counts/Constant.PAGE_VIEW_COUNT);
			if(pages<1)
				pages=1;
		map_page.put("pages", pages);
		return map_page;
	}
	
	public Map pageCount(int counts,int page_view_count)
	{
		this.counts=counts;
		Map map_page=new HashMap();
		map_page.put("counts", counts);
			if(counts%page_view_count!=0)
			{
				pages++;
			}
			pages+=(int)Math.ceil(counts/page_view_count);
			if(pages<1)
				pages=1;
		map_page.put("pages", pages);
		return map_page;
	}
	

}
